package cn.wolfcode.shop.cloud.mq;

import cn.wolfcode.shop.cloud.web.controller.SeckillOrderInfoController;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(
        consumerGroup = MQConstants.SECKILL_ORDER_BROAD_GROUP,
        topic = MQConstants.SECKILL_ORDER,
        selectorExpression = MQConstants.SECKILL_CREATE_BROAD_TAG,
        messageModel = MessageModel.BROADCASTING
)
public class OrderBroderMQListener implements RocketMQListener<Long> {
    @Override
    public void onMessage(Long seckillId) {
        System.out.println("进入到广播队列");
        SeckillOrderInfoController.isFlag.put(seckillId, false);
    }
}
